package com.learn.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/02/16
 * @description 切面类
 */
@Aspect
@Component
public class LogAspect {
    private static final Logger logger = LoggerFactory.getLogger(LogAspect.class);
    // 编写通用切点，实现代码复用
    @Pointcut("execution(public * com.learn.service..*(..))")
    public void logPointCut() {}
    @Before("logPointCut()")
    public void log(JoinPoint joinPoint) {
        logger.info(joinPoint.getSignature().getName() + "is cutting....");
    }
}
